<?php
/**
 * Модель log
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель log
 *
 */
class ModelLog extends Model {
	
	const TABLE				= 'log';
	const F_LOG_ID  	= 'log_id';
	const F_USER_ID  	= 'user_id';
	const F_MODE  	= 'mode';
	const F_ACTION_TIME  	= 'action_time';
	const F_ACTION  	= 'action';
	const F_DESCRIPTION  	= 'description';
	const F_MODEL  	= 'model';
	const F_MODEL_ID  	= 'model_id';
	const F_SESSION  	= 'session';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='log';
		$this->id_field=array(self::F_LOG_ID);
		$this->fields=array(
		self::TABLE.DOT.self::F_LOG_ID=> new Field($this,self::F_LOG_ID,self::TABLE,array(
				'auto'=>true,
				'important'=>true,
				'lenght'=>11)),
		self::TABLE.DOT.self::F_USER_ID=> new Field($this,self::F_USER_ID,self::TABLE,array(
				'lenght'=>11,
				'join_table'=>'user')),
		self::TABLE.DOT.self::F_MODE=> new Field($this,self::F_MODE,self::TABLE,array(
				'lenght'=>1,
				'validate_type'=>Validator::VALIDATE_BOOL)),
		self::TABLE.DOT.self::F_ACTION_TIME=> new Field($this,self::F_ACTION_TIME,self::TABLE,array(
				'important'=>true,
				'auto'=>true,
				'type'=>Field::TYPE_DATETIME)),
		self::TABLE.DOT.self::F_ACTION=> new Field($this,self::F_ACTION,self::TABLE,array(
				'lenght'=>3)),
		self::TABLE.DOT.self::F_DESCRIPTION=> new Field($this,self::F_DESCRIPTION,self::TABLE,array(
				'lenght'=>255,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_MODEL=> new Field($this,self::F_MODEL,self::TABLE,array(
				'lenght'=>20,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_MODEL_ID=> new Field($this,self::F_MODEL_ID,self::TABLE,array(
				'lenght'=>11)),
		self::TABLE.DOT.self::F_SESSION=> new Field($this,self::F_SESSION,self::TABLE,array(
				'lenght'=>20,
				'type'=>Field::TYPE_STRING))		);
	}
}
